<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
	<head>
		<title>Trombino - Evaluation �tudiant</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<script type="text/javascript" src="public/js/jquery.min.js"></script>
		<script type="text/javascript" src="public/js/d3.v2.js"></script>
		<script type="text/javascript">
		var arrRaisons = {0:"abscent", 1:"pr�sent", 2:"retard", 3:"travail non fait"};

		function Lance(){ 
         var x = prompt("saisir la largeur en cm ?"); 
         x = parseFloat(x); 
         var y = prompt(" saisir la longeur en cm ?");
          y = parseFloat(y); 
            var a =x*y;
          alert("la surface du rectangle est de :"+ a + "cm�");
          };
		 

          function saveRaison(r, etu) {
              //récupère les informations de l'étudiant
              var nom = $("#etu_nom_"+etu).text();
              var url = $("#etu_tof_"+etu).attr("src");
              var p = {"raison":r, "etu":nom, "url":url};
              
              $.get("ecrire.php", p,
                               function(data){
                                      alert(data);
                               });
              
              /*
              $.post("public/evaletu/ecrire", p,
                               function(data){
                                      dataCloud = data;
                               }, "json");
              */
      }
		
		</script>
				<style>
		.btn {
			cursor:pointer; 
		}
		.tof {
			width:200px; 
		}
		.good {
			color:green;
		}
		.bad {
			color:red;
		}
		.bar {
		  fill: steelblue;
		}
		</style>
		
		
	</head>
	<body >	
   <h1> Ecriture d'une fonction simple</h1>
<p>Cliquer sur le bouton pour lancer la fonction : <button  onclick="Lance()">Lancer la fonction</button></p>
		<?php 
		$xml = simplexml_load_file("https://picasaweb.google.com/data/feed/base/user/113848708930851956597/albumid/5795380358275112865?alt=rss&kind=photo&hl=fr");
		$i=0;
		foreach ($xml->channel->item as $item){
		echo "<div id='etu_".$i."' >";
		echo "<img src='public/img/timeP.jpg' class='btn' onclick='Lance()'/>";
		echo "<img src='public/img/timeR.jpg' class='btn' onclick='saveRaison(\"retard\",".$i.")' />";
		echo "<img src='public/img/timeA.jpg' class='btn' onclick='saveRaison(\"abscent\",".$i.")' />";
		echo "<img id='etu_tof_".$i."' src='".$item->enclosure['url']."' class='tof' onclick='getRaison(".$i.")' />";
		if($i % 2 == 0) $c = 'good'; else $c = 'bad'; 
		echo "<div class='$c' id='etu_nom_".$i."'>".$item->title."</div>";
		echo "<div id='etu_svg_".$i."'></div>";
		echo "</div>";
		$i++;
	}
	?>
	</body>
</html>
